#include <stm32f10x.h> // Device header
#include "led.hpp"
#include "exti.hpp"
#include "beep.hpp"
#include "exti_handler.h"
#include "TIMER.hpp"
#include "digi_tube.hpp"
#include "pwm.hpp"
uint16_t pwm_set_breath = 10; //设置呼吸灯的pwm
bool is_rising_or_falling = false;
void breath_light_run(void)
{

    TIM_SetCompare2(TIM4, 50);
}
int main()
{
    //使能时钟
    RCC_APB2PeriphClockCmd(RCC_APB2Periph_AFIO | RCC_APB2Periph_GPIOB | RCC_APB2Periph_GPIOA, ENABLE);
    // jtag??
    GPIO_PinRemapConfig(GPIO_Remap_SWJ_JTAGDisable, ENABLE);
    led_mode_t led_mode;
    // SysTick_CLKSourceConfig()
    led_mode.led_clear();
    led_mode.led_set(0xff);
    led_mode.led_init();
    led_mode_t::set_LED_gpio();
    beep_setup::beep_init();
    GPIO_WriteBit(GPIOA, GPIO_Pin_1, Bit_SET);
    // GPIO_Write(GPIOB, 0x77ff);
    //  GPIO_WriteBit(GPIOB, GPIO_Pin_7, Bit_RESET);
    Timer_setup::Timer_init(100, 360, TIM2_BASE, TIM2_IRQn, 2, 3);

    pwm_set::PWM_init_general(100, 36);
    Timer_setup::add_callback_function(breath_light_run);
    EXTI_settings::set_exti();
    digi_tube::digi_tube_init();

    // call_back_test_callback();
    while (1)
    {
    }
}
